package day27.Thread;

public class test1 {


    public static void main(String[] args) {
        Thread t1 = new Thread(new Runnable() {
            public void run() {
                System.out.println("t1线程开始执行");
                for (int i = 0; i <= 100; i++) {
                    if(i % 20 == 0) {
                        System.out.println("t1线程正在执行：" + i);
                    }
                }
            }
        });
        t1.start();

        Thread t2 = new Thread(new Runnable() {
            public void run() {
                System.out.println("t2线程开始执行");
                for (int i = 0; i <= 100; i++) {
                    if(i % 20 == 0) {
                        System.out.println("t2线程正在执行：" + i);
                    }
                }
            }
        });
        t2.start();

        Thread t3 = new Thread(new Runnable() {
            public void run() {
                System.out.println("t3线程开始执行");
                for (int i = 0; i <= 100; i++) {
                    if(i % 20 == 0) {
                        System.out.println("t3线程正在执行：" + i);
                    }
                }
            }
        });
        t3.start();

        //设置优先级
        t1.setPriority(Thread.MAX_PRIORITY);//10
        t2.setPriority(Thread.MIN_PRIORITY);//1
        t3.setPriority(Thread.NORM_PRIORITY);//5
    }
}
